﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebUI.Demo.Aspx
{
    public partial class ToDemoGetHtml : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var file = Request.QueryString["file"];
            var uri = "http://" + Request.Url.Host + ":" + Request.Url.Port + "/demo/templates/" + file;
            // Response.Write(uri); return;
            var req = (HttpWebRequest)WebRequest.Create(uri);
            var res = (HttpWebResponse)req.GetResponse();
            var respStream = res.GetResponseStream();
            if (respStream == null) return;
            var reader = new StreamReader(respStream, Encoding.UTF8);
            this.Literal1.Text = reader.ReadToEnd().Replace("<", "&lt;").Replace(">", "&gt;");
        }
    }
}